///////////////////////////////////////////////////////////
//  CPreviewDetailView.cpp
//  Implementation of the Class CPreviewDetailView
//  Created on:      21-Sep-2013 9:42:53 AM
//  Original author: Jakkaphan Aiemcharoenjit
///////////////////////////////////////////////////////////

#include "CPreviewDetailView.h"
#include "stdafx.h"

using namespace UI;

CPreviewDetailView::CPreviewDetailView(IWindowDirector* director)
{
  this->m_type = IViewCtrl::PREVIEWDETIALVIEW_T;
  this->m_parrentWnd = director;
  this->m_page = NULL;

  // call initialize for create all UI.
  Initialize();
}

CPreviewDetailView::~CPreviewDetailView()
{

}

IViewCtrl::ViewType CPreviewDetailView::GetType() const 
{
	return this->m_type;
}

void CPreviewDetailView::Initialize()
{
  this->SetAttribute<int>("x1", 0);
  this->SetAttribute<int>("y1", 0);
  this->SetAttribute("width", "100%");
  this->SetAttribute("height", "90%");
  this->SetAttribute("backgroundColour", CColour(COLOUR_PAGE));

  // Create navigationbar and set right button name
  this->m_navigationBar = CreateNavigationBar(CAttributes()
    .Set("name", "navBar")
    .Set("title", "Preview")
    .Set("leftButtonCaption", "Back")
    .Set("x1",      0)
    .Set("y1",      0)
    .Set("width",   "100%")
    .Set("height",  "10%"));

  // Setting event handler for handling navigation bar click
  this->m_navigationBar->SetEventHandler("clicknavigationbar", this, &CPreviewDetailView::OnClickedNavigationBar);

  // Add navigation bar in view
  this->AddChild(this->m_navigationBar);
}

void CPreviewDetailView::Refresh()
{

}

void CPreviewDetailView::ShowView(bool show)
{
  this->SetAttribute("visible", show);
}

void CPreviewDetailView::OnClickedBack()
{

}

void CPreviewDetailView::SetPage(IPage* page)
{

}

bool CPreviewDetailView::OnClickedNavigationBar( CNavigationBar *naviBar, int button )
{
  return true;
}

void CPreviewDetailView::SetTiltleView( const std::string& text )
{
  this->m_navigationBar->SetAttribute("title", text.c_str());
}
